import axios from './axios'
import resfulParamsToUrl from './resfulParamsToUrl'
// let CancelToken = axios.CancelToken
// let source = CancelToken.source()
// console.log(axios.CancelToken)
// 登录
export const login = params => {
	return axios
		.post(resfulParamsToUrl('/sys/noAuth/tsysuser/login', params), params)
		.catch(() => {})
}

// 菜单添加
export const menuInsert = params => {
	return axios
		.post(resfulParamsToUrl('/sys/auth/tmenudict/insert', params), params)
		.catch(() => {})
}

// 菜单查询
export const getMenuList = params => {
	return axios
		.post(resfulParamsToUrl('/sys/auth/tmenudict/getList', params), params)
		.catch(() => {})
}

// 菜单删除
export const deleteMenu = params => {
	return axios
		.post(resfulParamsToUrl('/sys/auth/tmenudict/delete', params), params)
		.catch(() => {})
}

// 菜单修改
export const updateMenu = params => {
	return axios
		.post(resfulParamsToUrl('/sys/auth/tmenudict/update', params), params)
		.catch(() => {})
}
// 菜单按钮权限
export const buttonSave = params => {
	return axios
		.post(resfulParamsToUrl('/sys/auth/tmenudict/buttonSave', params), params)
		.catch(() => {})
}

// 用户管理、用户查询
export const userManagement = params => {
	return axios
		.post(resfulParamsToUrl('/sys/auth/tsysuser/pageList', params), params)
		.catch(() => {})
}
// 用户新增
export const userInsert = params => {
	return axios
		.post(resfulParamsToUrl('/sys/auth/tsysuser/insert', params), params)
		.catch(() => {})
}
//用户修改
export const userModificationApi = params => {
	return axios
		.post(resfulParamsToUrl('/sys/auth/tsysuser/update', params), params)
		.catch(() => {})
}
//用户修改查重
export const userAccountCheck = params => {
	axios.prototype._show_error_ = false
	axios.prototype._loading_ = false
	return axios.post(
		resfulParamsToUrl('/sys/auth/tsysuser/userAccountCheck', params),
		params,
	)
}
// 用户删除
export const userDelete = params => {
	return axios
		.post(resfulParamsToUrl('/sys/auth/tsysuser/delete', params), params)
		.catch(() => {})
}
//用户查重
export const userGetList = params => {
	return axios
		.post(resfulParamsToUrl('/sys/auth/tsysuser/getList', params), params)
		.catch(() => {})
}
// 角色查重
export const roleNameCheck = params => {
	axios.prototype._show_error_ = false
	axios.prototype._loading_ = false
	return axios.post(
		resfulParamsToUrl('/sys/auth/tsysrole/roleNameCheck', params),
		params,
	)
}
// 已选数据
export const userGetRoleUserList = params => {
	return axios
		.post(
			resfulParamsToUrl('/sys/auth/troleuser/getRoleUserList', params),
			params,
		)
		.catch(() => {})
}
// 待分配用户
export const userGetUncheckedList = params => {
	return axios
		.post(
			resfulParamsToUrl('/sys/auth/troleuser/getUncheckedList', params),
			params,
		)
		.catch(() => {})
}
// 分配待分配用户
export const userUpdateRoleUsers = params => {
	return axios
		.post(
			resfulParamsToUrl('/sys/auth/troleuser/updateRoleUsers', params),
			params,
		)
		.catch(() => {})
}

// 移除已分配用户
export const userDeleteRoleUsers = params => {
	return axios
		.post(
			resfulParamsToUrl('/sys/auth/troleuser/deleteRoleUsers', params),
			params,
		)
		.catch(() => {})
}
// 角色管理
export const roleManagement = params => {
	return axios
		.post(resfulParamsToUrl('/sys/auth/tsysrole/pageList', params), params)
		.catch(() => {})
}
// 角色新增
export const roleInsert = params => {
	return axios
		.post(resfulParamsToUrl('/sys/auth/tsysrole/insert', params), params)
		.catch(() => {})
}
// 角色列表
export const roleTreeData = params => {
	return axios
		.post(resfulParamsToUrl('/sys/auth/tsysrole/treeData', params), params)
		.catch(() => {})
}
// 角色修改
export const roleUpdate = params => {
	return axios
		.post(resfulParamsToUrl('/sys/auth/tsysrole/update', params), params)
		.catch(() => {})
}
// 角色删除
export const roleDelete = params => {
	return axios
		.post(resfulParamsToUrl('/sys/auth/tsysrole/delete', params), params)
		.catch(() => {})
}
// 菜单列表
export const getGetList = params => {
	return axios
		.post(resfulParamsToUrl('/sys/auth/tmenudict/getAllList', params), params)
		.catch(() => {})
}
// 菜单列表保存
export const getInsert = params => {
	return axios
		.post(resfulParamsToUrl('/sys/auth/troleusermenu/insert', params), params)
		.catch(() => {})
}
// 菜单列表查询
export const getCheckedMenuList = params => {
	return axios
		.post(
			resfulParamsToUrl('/sys/auth/troleusermenu/getCheckedMenuList', params),
			params,
		)
		.catch(() => {})
}
// 分配权限
export const assignPermissions = params => {
	axios.prototype._show_error_ = false
	axios.prototype._loading_ = false
	return axios.post(
		resfulParamsToUrl('/sys/auth/tmenudict/assignPermissions', params),
		params,
	)
}
// 分配权限点击
export const assignPermissionsTree = params => {
	axios.prototype._show_error_ = false
	axios.prototype._loading_ = false
	return axios.post(
		resfulParamsToUrl('/sys/auth/tmenudict/assignPermissionsTree', params),
		params,
	)
}
//医院接口管理
//分页查询
export const hospInterfacePageList = params => {
	axios.prototype._loading_ = false
	return axios.post(
		resfulParamsToUrl('/sys/noAuth/hospInterfaceManage/pageList', params),
		params,
	)
}
//新增
export const insertHospInterface = params => {
	axios.prototype._loading_ = false
	return axios.post(
		resfulParamsToUrl('/sys/noAuth/hospInterfaceManage/insert', params),
		params,
	)
}
//修改
export const updateHospInterface = params => {
	axios.prototype._loading_ = false
	return axios.post(
		resfulParamsToUrl('/sys/noAuth/hospInterfaceManage/update', params),
		params,
	)
}
//删除
export const deleteHospInterface = params => {
	axios.prototype._loading_ = false
	return axios.post(
		resfulParamsToUrl('/sys/noAuth/hospInterfaceManage/delete', params),
		params,
	)
}

//自定义表单管理新加下拉
export const getPriceList = params => {
	axios.prototype._loading_ = false
	return axios.post(
		resfulParamsToUrl('/sys/auth/syscustomerform/getPriceList', params),
		params,
	)
}

//服务商API
// export const sysFacApiPageList = params => {
// 	axios._loading_ = false
// 	return axios.post(
// 		resfulParamsToUrl('/sys/noAuth/sysFacApi/pageList', params),
// 		params,
// 	)
// }
